package cate.game.client.interceptor;

import cate.game.GameBody;
import cate.game.client.ClientContext;
import cate.game.client.msg.MsgInput;

public class CommandExecutorImpl implements CommandExecutor{
    protected CommandInterceptor first;

    public CommandExecutorImpl(CommandInterceptor first) {
        this.first = first;
    }

    public CommandInterceptor getFirst() {
        return first;
    }

    public void setFirst(CommandInterceptor commandInterceptor) {
        this.first = commandInterceptor;
    }

    @Override
    public void execute(MsgInput msgInput, GameBody gameBody, ClientContext clientContext) {
        if(gameBody.isRunning()) {
            first.execute(msgInput, gameBody, clientContext);
        }
    }
}
